import { dosql } from "../tool/sqlTool";
import { LeaveMessage } from "../tool/varType";
export async function readleaveMessage(page: number) {
  return dosql(
    `select * from leavemessage order by create_time asc limit ${
      (page - 1) * 10
    },10`,
    []
  );
}
// 查询数据的总条数
export async function getleavemsgtotal() {
  return dosql(`select count(*) as total from leavemessage  `, []);
}
export async function saveleavemessage(leavemessage: LeaveMessage) {
  return dosql(
    "Insert into leavemessage (nick,content,create_time)  values (?,?,now())",
    [leavemessage.nick, leavemessage.content]
  );
}
